/*
 * @Description: 
 * @Author: chenjiaxin
 * @Date: 2021-12-20 21:32:20
 * @LastEditTime: 2022-01-05 21:12:10
 * @FilePath: \novel-serve\src\router\auth.router.js
 */
const Router = require("koa-router");

const { verifyLogin, verifyLoginCode } = require("../middleware/auth.middleware");
const { login } = require("../controller/auth.controller");
const { paramCheckBody } = require("../middleware/check.middleware");

const authRouter = new Router({prefix: "/auth"});

// authRouter.post("/register", verifyUser, handlePassword, createUser);
// paramCheckBody(false, "e_mail", "password") 
authRouter.post("/login", paramCheckBody(false, "e_mail", "password"), verifyLogin, login);

//邮箱验证码登录
authRouter.post("/loginCode", paramCheckBody(false, "e_mail", "code"), verifyLoginCode, login);

module.exports = authRouter;